Tool Support for Refactoring Duplicated OO Code
نویسندگان
چکیده
Code duplication is an important problem in application maintenance. Tools exist that support code duplication detection. However, few of them propose a solution for the problem, i.e. refactorings. We propose an approach that uses the information given by code duplication detection to guide the refactorings of OO applications. 1 Code Duplication and Refactorings: Two Poles of a Magnet Code duplication is a well-known problem in software maintenance, bloating up source code and complicating the extermination of errors. Tool support exists that helps to identify the duplicated code [JP93, Bak92, BYM+98, DRD99]. Refactorings are a way to transform an application [OJ92] in a behavior preserving manner. Refactoring tools [RBJ97] support the elementary operations to transform code. Duplication is one important aspect of code where refactorings can be used to improve the source code. Very few tools, however, support corrections of systems plagued by duplicated code. In [Bak97, BYM+98], macro extraction from source code (C and C++) were proposed, but these approaches did not tackle the intricate problems of refactorings in an object-oriented context. In this paper, we propose to use a duplication detection tool to guide the refactoring process. We want to stress the fact that our proposition is not to fully automate the process but to help the reengineer by doing a first analysis of the situation and providing him with a solution if possible. This paper presents first an overview over the ingredients that we need for our idea and then gives a short overview how duplication in object-oriented code can be categorized and tackled. 2 Combining Duplication Information and a Static Object-Oriented Model The first ingredient for our approach is obviously a tool to detect duplication in source code. Secondly, the approach is based on the ability to represent a program in terms of object-oriented entities, like for example classes, methods and attributes (see section 2.2 To represent the program in such a model is crucial since the possible refactorings that can be carried out on duplication found in object-oriented code depend on the structural relationships of the program entities the duplication was found in. In this section, we first detail the two ingredients, then propose a step by step recipe which combines them for the goal of guiding refactorings. 2.1 Identifying Duplication DUPLOC is a tool for detecting duplicated code [RD98, DRD99]. DUPLOC has been developed in the context of the FAMOOS Esprit project and features:
منابع مشابه
Formal UML Support for the semi-automatic Application of object-oriented Refactorings
With the recent success of refactoring, UML tool vendors seek ways to support programmers in applying a (sequence of) refactoring(s). The problem with such tools is that the UML metamodel – on which their repository is based – is inadequate to maintain the consistency between the model and the code while one of them gets refactored. Therefore, we propose a set of minimal extensions to the UML m...
متن کاملEnabling and Using the UML for Model Driven Refactoring
There is a historical gap between UML tools and refactoring tools. The former tools are designed to produce analysis and design models whereas the latter are designed to manipulate program code. MDA tool vendors aim to bridge this gap by regenerating program code from evolving UML OOAD models and vice versa. In this position paper, we describe the problems and a novel solution for implementing ...
متن کاملSPQR: Formalized Design Pattern Detection and Software Architecture Analysis
We present formal analysis methods and results from SPQR, the System for Pattern Query and Recognition, a toolkit that detects instances of known design patterns directly from object-oriented source code in an automated and flexible manner. Based on previous work in rhocalculus (extended Abadi/Cardelli sigma-calculus) and Pattern/Object Markup Language (POML), the SPQR toolset is easily retarge...
متن کاملTowards Automating Source-Consistent UML Refactorings
With the increased interest in refactoring, UML tool vendors seek ways to support software developers in applying a (sequence of) refactoring(s). The problem with such tools is that the UML metamodel – on which their repository is based – is inadequate to maintain the consistency between the model and the code while one of them gets refactored. Therefore, we propose a set of minimal extensions ...
متن کاملSub-clones: Considering the Part Rather than the Whole
Researchers have proposed various automated clone detection tools that can assist programmers in finding code clones (i.e., duplicated sections of code). Such tools can serve as input into the process of clone removal through refactoring activities. In this paper, we consider the scenario in which an automated clone detection tool was used to find code clones as part of the clone refactoring pr...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1999